package com.shitou.pojo;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.shitou.util.DateUtil;

@Entity
@Table(name="t_milestone")
public class Milestone {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;
	
	private String name;
	private String createdate;
	private String updatedate;
	
	@ManyToOne
	@JoinColumn(name="projectid")
	private Project project;
	
	@OneToMany(mappedBy="milestone",fetch=FetchType.LAZY)
	private List<Issues> issueses;
	
	//getter and setter
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCreatedate() {
		return createdate == null ? null : DateUtil.friendlyTime(DateUtil.stringToDate(createdate));
	}
	public void setCreatedate(String createdate) {
		this.createdate = createdate;
	}
	public String getUpdatedate() {
		return updatedate;
	}
	public void setUpdatedate(String updatedate) {
		this.updatedate = updatedate;
	}
	public Project getProject() {
		return project;
	}
	public void setProject(Project project) {
		this.project = project;
	}
	public List<Issues> getIssueses() {
		return issueses;
	}
	public void setIssueses(List<Issues> issueses) {
		this.issueses = issueses;
	}
}
